package com.itheima.health.dao;

import com.itheima.health.dto.SetmealAnalyDto;
import com.itheima.health.dto.SetmealReportParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface CountingDao {
    /*
    * 根据日期查询会员数量
    * */
    Integer getMemberReport(LocalDate first, LocalDate lasDate);
/*
* 查询今日套餐占比
* */
    List<SetmealAnalyDto> gettodayDateSetmeal(LocalDate todayDate);
/*
* 查询当日的总预约数
* */
    @Select("select count(*)t from t_order where orderDate=#{todayDate}")
    Integer getSetmealNuber(LocalDate todayDate);

/*
* 今日新增会员
* */

    Integer gettodayeNewmber(LocalDate todayDate);
/*
* 查询本周新增会员
* */
    @Select("select count(*) from t_ordersubmit where regTime>#{thisStaWeekdate} and regTime<#{thisEndweekdate}")
    Integer getWookNermber(LocalDate thisStaWeekdate, LocalDate thisEndweekdate);
/*
* 查询本月新增会员
* */
    @Select("select count(*) from t_ordersubmit where regTime>#{beng} and regTime<#{end}")
    Integer getmonthNewnumb(LocalDate beng, LocalDate end);
/*
* 查询今日预约数
* */
    @Select("select count(*) from t_order where orderDate=#{todayDate}")
    Integer getOrderNumb(LocalDate todayDate);
/*
* 今日到诊
* */
    @Select("select count(*) from t_order where orderDate=#{todayDate} and orderStatus=#{orderstatusYes}")
    Integer getVisitNumb(LocalDate todayDate, String orderstatusYes);
/*
* 本周预约数
* */
    @Select("select count(*) from t_order where orderDate>#{thisStaWeekdate} and orderDate<#{thisEndweekdate}")
    Integer getOrderWeeknumb(LocalDate thisStaWeekdate, LocalDate thisEndweekdate);
/*
* 本月预约数
* */
    @Select("select count(*) from t_order where orderDate>#{beng} and orderDate<#{end}")
    Integer getMontOrder(LocalDate beng, LocalDate end);
/*
* 本月到诊
* */
    @Select("select  count(*) from t_order where orderDate>#{beng} and orderDate<#{end} and orderStatus=#{orderstatusYes}")
    Integer getMontOrderVisit(LocalDate beng, LocalDate end, String orderstatusYes);
/*
* 本周到诊
* */
    @Select("select count(*) from t_order where orderDate>#{thisStaWeekdate} and orderDate<#{thisEndweekdate} and orderStatus=#{orderstatusYes}")
    Integer getVisitOrderNumb(LocalDate thisStaWeekdate, LocalDate thisEndweekdate, String orderstatusYes);
}
